package test9;

public class Test {
    public static void main(String[] args) {
        Student[] students = new Student[5];
        students[0] = new Student("张三",18,1001,"男");
        students[1] = new Student("李四",19,1002,"女");
        students[2] = new Student("王五",20,1003,"男");
        students[3] = new Student("赵六",21,1004,"女");
        students[4] = new Student("赵六",22,1004,"男");


        for (int i = 0; i < students.length-1; i++) {
            if (students[i].getId() == students[i+1].getId()&&students[i].getName().equals(students[i+1].getName())){
                System.out.println("他们是同一个人");
                //输出他们两个的信息
                System.out.println(students[i].getName()+" "+students[i].getAge()+" "+students[i].getId()+" "+students[i].getSex());
                System.out.println(students[i+1].getName()+" "+students[i+1].getAge()+" "+students[i+1].getId()+" "+students[i+1].getSex());
            }
        }
    }
}
